let totalPage, currentPage, UID
/**
 * 
 * @param {page} 要获取第几页的数据 
 * @param {obj} 条件参数
 * @param {setTotal} 设置总数 
 */
const getUsers =(page, obj ,setTotal) => {
	axiosRequest1("post", `/user/queryByCondition/${page}/10`, obj).then(res => {
		const {
			code,
			data,
			message
		} = res.data
		if (code == 200) {
			setTotal(data.totalSize)
			let str;
			data.list.forEach(item => {
				str += `<tr>
							<td>${item.id}</td>
							<td>${item.uname}</td>
							<td>${item.phone}</td>
							<td>${item.dept}</td>
							<td>${item.job}</td>
							<td>${item.sex===1 ? '男' : '女'}</td>
							<td>${item.birthday}</td>
							<td>${item.statu===1 ? '在职' : '离职'}</td>
							<td>${item.hiredate}</td>
							<td>${item.leavedate}</td>
							<td>
								<a href="userUpdate.html?uid=${item.id}" class="tablelink">修改</a>
							</td>
							</tr>`
			})
			$('#tbody').html(str)
			$('#totalpage').text(data.totalPage)
			$('#page').text(data.page)
			$("#pageSelect").val(data.page)
			$('.tablelist tbody tr:odd').addClass('odd');
		} else {
			let warninfo = $('#warninfo')
			warninfo.text(message)
			warninfo.show()
			setTimeout(() => {
				warninfo.hide()
			}, 2000)
		}
	}, error => {
		console.log(error);
	})
}

function tipOpen(content, uid) {
	UID = uid;
	$(".tipright p").text(content);
	$("#tip").fadeIn(200);
}

function tipClose() {
	$("#tip").fadeOut(200);
}

function setStatu() {
	tipClose()
	axiosRequest1("post", "/user/update/statu", {
		uId: UID
	}).then(res => {
		const {
			code,
			message
		} = res.data
		let warninfo = $('#warninfo')
		warninfo.text(code === 200 ? "error:修改状态成功" : "error:修改状态失败")
		warninfo.show()
		setTimeout(() => {
			warninfo.hide()
		}, 2000)
	}, err => {
		console.log(err);
	})
}
